/**
 * ...
 * >author		João Vítor de Souza
 */

package com.cupcakeengine.display 
{
	import com.cupcakeengine.core.IDestroyable;
	import flash.display.Stage;
	import flash.geom.Rectangle;
	import flash.media.StageWebView;

	public class AdMobView implements IDestroyable
	{
		// ___________________________________________________________________ CONSTANTS		
		
		// ___________________________________________________________________ CLASS PROPERTIES
		
		// ___________________________________________________________________ INSTANCE PROPERTIES
		
		private var _webView							: StageWebView;
		
		// ___________________________________________________________________ GETTERS AND SETTERS
		
		// ___________________________________________________________________ CONSTRUCTOR
		
		public function AdMobView() { }
		
		// ___________________________________________________________________ PUBLIC METHODS				
		
		public function init(stage:Stage, url:String, rectangle:Rectangle):void
		{
			_webView = new StageWebView();
			_webView.stage = stage;			
			_webView.viewPort = rectangle;
			_webView.loadURL(url);
		}
		
		/* INTERFACE com.mifiz.core.IDestroyable */
		
		public function destroy():void
		{
			_webView.dispose();
			_webView = null;
		}
		
		// ___________________________________________________________________ PRIVATE METHODS
		
		// ___________________________________________________________________ EVENTS
	}
}

